Fix edge labels rendered behind nodes and selected edges#203
Conversation
✅ Deploy Preview for swf-editor ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #199 by ensuring edge labels consistently render above parent nodes and above selected edges in the React Flow-based diagram editor.
Changes:
- Elevates the React Flow edge-label renderer container via CSS so labels don’t get painted behind nodes.
- Introduces a z-index hierarchy where regular edges (0) < selected edges (100) < labels (1000+), and disables React Flow’s automatic edge elevation on select.
- Adds/updates unit tests to cover edge/label z-index behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/serverless-workflow-diagram-editor/tests/react-flow/edges/Edges.test.tsx | Adds tests for EdgeLabel z-index behavior and edge selection integration. |
| packages/serverless-workflow-diagram-editor/tests/react-flow/diagram/Diagram.test.tsx | Adds tests for elevateEdgesOnSelect={false} and edge z-index behavior in Diagram. |
| packages/serverless-workflow-diagram-editor/src/react-flow/edges/Edges.tsx | Adds selected-aware z-index styling to edge labels. |
| packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.tsx | Applies explicit z-index management for edges and disables automatic edge elevation on selection. |
| packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.css | Elevates .react-flow__edgelabel-renderer above nodes to prevent labels being hidden. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5390e99 to
3f898d0
Compare
33ede30 to
c26042c
Compare
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
c26042c to
99f8a18
Compare
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
fantonangeli
left a comment
There was a problem hiding this comment.
LGTM, I only left a comment
There was a problem hiding this comment.
I think this file will be very useful in the future, and we won't lose track of the z-indexes
| expect(resultString).toContain(`"zIndex":${expectedZIndex}`); | ||
| }); | ||
|
|
||
| it("applies default regular label z-index when selected prop is not provided", () => { |
There was a problem hiding this comment.
I think this test is already covered by the selected: undefined at line 516
|
This PR is good enough to be merged. Thanks |
Closes: #199
Summary
This PR fixed the issue where edge labels are being rendered behind parent nodes and selected edges.
Changes